﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace _16一对多;

public class ArticleConfig:IEntityTypeConfiguration<Article>
{
    public void Configure(EntityTypeBuilder<Article> builder)
    {
        builder.ToTable("T_Articles");
        builder.Property(a => a.Title).HasMaxLength(50).IsRequired();
        builder.Property(a => a.Content).IsUnicode().IsRequired();
        // builder.Property(a => a.IsDeleted).IsRequired();
        builder.HasQueryFilter(a => !a.IsDeleted);
    }
}